import Taro from "@tarojs/taro";

const baseUrl = "http://10.36.138.68:2568";
const version = "/api/v1";
export default function (url, method = "GET", data) {
  return new Promise((resolve, reject) => {
    let token = Taro.getStorageSync('token')
    // console.log("token",token);
    Taro.request({
      url: baseUrl + version + url,
      method,
      data,
      header:{
        Authorization:token
      },
      success(res) {
        resolve(res.data);
      },
      fail(error) {
        reject(error);
      },
    });
  });
}
